package A04_MySet;

import java.util.LinkedHashSet;

public class LinkedHashSetDemo1 {
    public static void main(String[] args) {
        //LinkedHashSet:有序、不重复、无索引
        Student s1 = new Student("cgc",18);
        Student s2 = new Student("kzy",19);
        Student s3 = new Student("has",20);
        Student s4 = new Student("cgc",18);

        //1、创建集合对象
        LinkedHashSet<Student> lsh = new LinkedHashSet<>();

        System.out.println(lsh.add(s1));
        System.out.println(lsh.add(s2));
        System.out.println(lsh.add(s3));
        System.out.println(lsh.add(s4));

        System.out.println(lsh);
    }
}
